<template>
  <div class="run-modal-style">
    <Form :label-width="120">
      <Row class="code-row-bg" v-for="(val,key) in resData" :key="key">
        <template v-if="key != '_index' && key != '_rowKey'">
          <Col span="24" style="border:none;">
            <Form-item :label="key">
              <Input
                v-if="key == '请求体' || key == '响应体' || key == '响应报错信息'"
                type="textarea"
                readonly
                v-model="resData[key]"
                :autosize="{minRows: 2}"
                
              ></Input>
              <Input v-else v-model="resData[key]"  readonly></Input>
            </Form-item>
          </Col>
        </template>
      </Row>
    </Form>
  </div>
</template>

<script>
import { tryCallback } from '@api/flowable/tenantManage.js'
export default {
  name: 'callbackDetails',
  props: {
    resData: {}
  },
  data() {
    return {
      actions: [
        {
          text: this.$t('module.tenantManage.tryAgain'),
          theme: 'primary',
          handle: () => {
            this.tryAgin()
          },
          loading: false
        },
        {
          text: this.$t('common.close'),
          handle: () => {
            this.$emit('Close')
          }
        }
      ]
    }
  },
  created() {
    this.$emit('SetTitle', this.$t('module.tenantManage.callbackDetail'))
    this.$emit('SetPageActions', this.actions)
  },
  methods: {
    tryAgin() {
      this.actions[0].loading = true
      tryCallback({ id: this.resData.id })
        .then(res => {
          this.actions[0].loading = false
          this.$Message.success({
            content: this.$t('module.tenantManage.tryAgainSuccess'),
            duration: 3
          })
          this.$emit('Close', this.resData)
        })
        .catch(err => {
          this.actions[0].loading = false
          this.$emit('Close', this.resData)
        })
    }
  }
}
</script>
